package com.wisdom.weld.util;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class IOUtils {

    public static FileWriter getFileWriter(String dirPath, String fileName) throws IOException {
        Path targetPath = Paths.get(dirPath);
        if (!Files.exists(targetPath)) {
//            Files.createDirectory(targetPath);
            Files.createDirectories(targetPath);
        }
        File targetFile = new File(dirPath, fileName);
        FileWriter fileWriter = new FileWriter(targetFile);
        return fileWriter;
    }


}
